<?php
namespace Admin\Controller;
use Think\Controller;
class UserDelController extends CommonController {



    public function index(){
    	$res=M('user')->where("ustate='2'")->select();
    	$this->assign('user',$res);
        $this->display();
    }



    public function recovery()
    {
    	$id=I('post.uid');
    	$res=M('user')->where("id='{$id}'")->setField('ustate','0');
    	if ($res) {
    		$arr=array(
                'error'=>0,
                'info'=>'恢复成功'
                );
            echo json_encode($arr);
            exit();
    	}else{
    		$arr=array(
                'error'=>1,
                'info'=>'操作失败'
                );
            echo json_encode($arr);
            exit();
    	}
    	
    }

    public function recoveryall()
    {
    	$num=I('post.num');
    	$num=rtrim($num,',');
    	$res=M('user')->where("id in($num)")->setField('ustate','0');;
    	if ($res) {
    		$arr=array(
                'error'=>0,
                'info'=>'恢复成功'
                );
            echo json_encode($arr);
            exit();
    	}else{
    		$arr=array(
                'error'=>1,
                'info'=>'操作失败'
                );
            echo json_encode($arr);
            exit();
    	}
    }
}